package com.cheer.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cheer.dto.StandingBookReviewLogDTO;
import com.cheer.entity.StandingBookReviewLog;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface StandingBookReviewLogDao extends BaseMapper<StandingBookReviewLog> {

    List<StandingBookReviewLogDTO> listByAccountId(@Param("applicantId") Long applicantId, @Param("reviewType") Integer type);

    default List<StandingBookReviewLog> selectDenyByApplicantIds(List<Long> applicantIds, String noPass, Integer code){

        QueryWrapper<StandingBookReviewLog> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda()
                .in(StandingBookReviewLog::getApplicantId, applicantIds)
                .eq(StandingBookReviewLog::getAction, noPass)
                .eq(StandingBookReviewLog::getReviewType, code);
        return selectList(queryWrapper);
    }

    List<StandingBookReviewLog> selectByApplicantIdsAndAction(@Param("applicantIds") List<Long> appIds, String action);
}
